package errorx

import (
	"fmt"
	"gitee.com/davel-go/gozero-common/codex"
)

type CodeError struct {
	Code codex.Code `json:"code"`
	Msg  string     `json:"msg"`
}

func NewCodeError(code codex.Code, msg string) error {
	return &CodeError{Code: code, Msg: msg}
}

func (e *CodeError) Error() string {
	return fmt.Sprintf("ErrCode:%d，ErrMsg:%s", e.Code, e.Msg)
}
